# -*- coding:UTF-8 -*-


def test_empty_list():
    '''
    可以将None的list置为默认空置
    :return:
    '''
    li = None
    handlers = list(li or [])
    print handlers


def test_assert():
    '''
    测试断言，若失败则抛出异常
    :return:
    '''
    assert 1 == 1


def son_tuple():
    return 1, 2


def test_tuple():
    '''
    可以利用tuple直接给多个变量赋值
    :return:
    '''
    a, b = son_tuple()
    print '测试tuple：', a, b


def test_type():
    '''
    判断是否为某类型实例
    :return:
    '''
    d = (r"/regional_hospital_statistics", 'handler', dict(db='sql'))
    # 判断类型
    print isinstance(d, (tuple, list))
    # 复习tuple特性
    print type(d[1:])
    print d[1:]

def map_test():
    d = [1, 2, 3]
    e = map(lambda a: a-1, d)
    print e

map_test()